<template>
	<view class="page_view">
		<view class="list">
			<view class="list-item" v-for="(item,index) in list" :key="index" @tap="go_RecordDetild(item)">
				<view class="list-item-top" v-if="item.orders">
					<image :src="baseUrl.cdnurl+item.orders.shop.avatar" class="list-item-top-img" mode=""></image>
					<view class="list-item-top-text">
						{{item.orders.shop.shopname}}
					</view>
				</view>
				<view class="list-item-min1" v-for="(items,indexs) in item.order_item">
					<view class="list-item-min">
						<image :src="baseUrl.cdnurl+items.image" class="list-item-min-img" mode="" v-if="items.goods_item.platform == 0"></image>
						<image :src="items.image" class="list-item-min-img" mode="" v-else></image>
						<view class="list-item-min-right">
							<view class="list-item-min-right-top">
								{{items.title}}
							</view>
							<view class="list-item-min-right-bottom">
								¥ {{items.price}}
							</view>
							<view class="list-item-min-right22">
								<view class="item_time">
									{{item.createtime_text}}
								</view>
								<view class="item_time">
									{{item.state == 1?'待支付':item.state == 2?'待发货':item.state == 3?'待收货':item.state == 4?'待评论':item.state == 5?'售后订单':item.state == 6?'已完成':item.state == 7?'已取消':item.state == 8?'待审核':''}}
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import config from '@/utils/base.js';
	export default {
		data() {
			return {
				list:[],
				page:1,
				last_page:'',
				baseUrl: config,
			}
		},
		onLoad() {
			this.get_list()
		},
		onReachBottom() {
			if(this.page < this.last_page){
				this.page ++;
				this.get_list()
			}else{
				uni.showToast({
					title:'已经到底了哦',
					icon:'none'
				})
			}
		},
		methods: {
			go_RecordDetild(item){
				uni.navigateTo({
					url:'/pages/BuyBack/RecordDetild/RecordDetild?order_id='+item.id
				})
			},
			get_list(){
				let t = this
				t.$get({
					url: '/wanlshop/buyback/list',
					data:{
						page:t.page,
						pageSize:10
					}
				}).then((res) => {
					console.log(res)
					t.list = [...t.list,...res.data.data]
					t.last_page = res.data.last_page
				});
			}
		}
	}
</script>

<style scoped>
	page{
		background-color: #fff;
	}
.list{
	width: 100%;
	padding-bottom:100rpx;
}
.list-item{
	width: 100%;
	/* height: 220rpx; */
	border-bottom: #F4F4F4 solid 2rpx;
	padding:32rpx;
	box-sizing: border-box;
}
.list-item-top{
	display: flex;
	align-items: center;
}
.list-item-top-img{
	width: 30rpx;
	height: 30rpx;
	background-color: #ddd;
	border-radius: 50%;
	margin-right: 6rpx;
}
.list-item-min1{
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.list-item-min{
	width: 100%;
	display: flex;
	align-items: center;
	margin-top: 16rpx;
}
.list-item-min-img{
	min-width: 116rpx;
	width: 116rpx;
	height: 116rpx;
	border-radius: 12rpx;
	border: 2rpx solid #F4F4F4;
	margin-right: 20rpx;
}
.list-item-min-right{
	width: calc(100% - 136rpx);
}
.list-item-min-right-top{
	
	font-size: 32rpx;
	font-family: Alibaba PuHuiTi 2.0-65 Medium, Alibaba PuHuiTi 20;
	font-weight: normal;
	color: #333333;
	text-overflow: ellipsis;
	display: -webkit-box;
	-webkit-line-clamp: 1;
	overflow: hidden;
	/*! autoprefixer: off */
	-webkit-box-orient: vertical;
	/*! autoprefixer: on */
	word-break: break-all;
}
.list-item-min-right-bottom{
	font-size: 26rpx;
	font-family: Alibaba PuHuiTi 2.0-65 Medium, Alibaba PuHuiTi 20;
	font-weight: normal;
	color: #E42D1D;
	margin-top: 14rpx;
}
.list-item-min-right-bottom-text{
	font-size: 34rpx;
}
.list-item-min-right22{
	width: 100%;
	
	font-size: 25rpx;
	font-family: Alibaba PuHuiTi 2.0-55 Regular, Alibaba PuHuiTi 20;
	font-weight: normal;
	color: #333;
	display: flex;
	align-items:center;
	justify-content: space-between;
}
.item_time{
	margin-top: 20rpx;
}
</style>
